<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js" integrity="sha256-iM4Yzi/zLj/IshPWMC1IluRxTtRjMqjPGd97TZ9yYpU=" crossorigin="anonymous"></script>
  <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Cousine|Inconsolata" rel="stylesheet">
  <link rel="shortcut icon" type="image/png" href="/favicon.png">

  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/css/css/fontawesome-all.min.css">
  <link rel="stylesheet" href="/css/css/work-sans-v7.css">
  <script src="/js/main.js"></script>

  <!-- Begin Jekyll SEO tag v2.6.1 -->
<title>JS: Get State Replacement Api | Hive Developer</title>
<meta name="generator" content="Jekyll v4.0.0" />
<meta property="og:title" content="JS: Get State Replacement Api" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="This is a list of replacement API calls for each of the different routes available from the getState function." />
<meta property="og:description" content="This is a list of replacement API calls for each of the different routes available from the getState function." />
<link rel="canonical" href="get_state_replacement_api.html" />
<meta property="og:url" content="get_state_replacement_api.html" />
<meta property="og:site_name" content="Hive Developer" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-08-26T11:52:22-07:00" />
<script type="application/ld+json">
{"description":"This is a list of replacement API calls for each of the different routes available from the getState function.","mainEntityOfPage":{"@type":"WebPage","@id":"get_state_replacement_api.html"},"@type":"BlogPosting","url":"get_state_replacement_api.html","headline":"JS: Get State Replacement Api","dateModified":"2020-08-26T11:52:22-07:00","datePublished":"2020-08-26T11:52:22-07:00","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->


  
</head>
<body>
<header>
  <h1>
    <button type="button" class="open-nav" id="open-nav"></button>
    <a href="/"  class="logo-link"><img src="/images/logotype_black.svg" height="40" alt="Hive Developer logo"></a>
  </h1>

  
  <form action="/search/" method="get">
    <input type="text" name="q" id="search-input" placeholder="Search">
    <input type="submit" value="Search" style="display: none;">
  </form>
  

  <div id="sidebar" class="sidebar">
	
	
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/">
		<h6 class="ctrl-nav-section title">Introduction</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/#introduction-welcome">Welcome to Hive</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/quickstart/">
		<h6 class="ctrl-nav-section title">Quickstart</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/quickstart/#quickstart-choose-library">Choose Library</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-hive-full-nodes">Hive Nodes</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-testnet">Hive Testnet</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/tutorials/">
		<h6 class="ctrl-nav-section title">Tutorials</h6>
		<ul class="cont-nav-section content">
			
				
					
						<li><a href="/tutorials/#tutorials-javascript">Javascript</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-python">Python</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-ruby">Ruby</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-recipes">Recipes</a></li>
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/services/">
		<h6 class="ctrl-nav-section title">Services</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/services/#services-hive-blog">hive.blog</a></li>
						
					
						
						<li><a href="/services/#services-hivesigner">HiveSigner</a></li>
						
					
						
						<li><a href="/services/#services-jussi">Jussi</a></li>
						
					
						
						<li><a href="/services/#services-imagehoster">ImageHoster</a></li>
						
					
						
						<li><a href="/services/#services-dhf">DHF</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/apidefinitions/">
		<h6 class="ctrl-nav-section title">Appbase API</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/apidefinitions/#apidefinitions-condenser-api">Condenser Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-bridge">Bridge</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-by-key-api">Account By Key Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-history-api">Account History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-block-api">Block Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-database-api">Database Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-debug-node-api">Debug Node Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-follow-api">Follow Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-jsonrpc">Jsonrpc</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-market-history-api">Market History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-network-broadcast-api">Network Broadcast Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rc-api">Rc Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-reputation-api">Reputation Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rewards-api">Rewards Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-tags-api">Tags Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-transaction-status-api">Transaction Status Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-witness-api">Witness Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops">Broadcast Ops</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops-communities">Broadcast Ops Communities</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/resources/">
		<h6 class="ctrl-nav-section title">Resources</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/resources/#resources-overview">Overview</a></li>
						
					
						
						<li><a href="/resources/#resources-client-libs">Client Libraries</a></li>
						
					
						
						<li><a href="/resources/#resources-bluepaper">Bluepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-whitepaper">Whitepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-tools">Tools</a></li>
						
					
						
						<li><a href="/resources/#resources-hivesigner-libs">Hivesigner Libs</a></li>
						
					
						
						<li><a href="/resources/#resources-hive-keychain">Hive Keychain</a></li>
						
					
						
						<li><a href="/resources/#resources-developeradvocate">Community & Help</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/glossary/">
		<h6 class="ctrl-nav-section title">Glossary</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/glossary/#glossary-chain-basics">Chain Basics</a></li>
						
					
						
					
						
						<li><a href="/glossary/#glossary-governance">Governance</a></li>
						
					
						
						<li><a href="/glossary/#glossary-transactions">Transactions</a></li>
						
					
						
						<li><a href="/glossary/#glossary-api">API</a></li>
						
					
						
						<li><a href="/glossary/#glossary-market">Market</a></li>
						
					
				
			
		</ul>
	</section>
	
</div>



  <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
</header>
<div class="main" id="top">
  <div class="hero">
    <h1 class="hero__h1">Hive Developer Portal </h1>
    <img class="hero__img" src="/images/honey-comb-92.png" style="position: relative; top: 10px;" />
  </div>
  <section id="tutorials-javascript-get-state-replacement-api" class="row tutorials-javascript-get-state-replacement-api">
	<h3>
		<a id="tutorials-javascript-get-state-replacement-api">
			JS: Get State Replacement Api
			
		</a>
	</h3>
	
		<span class="description"><p>This is a list of replacement API calls for each of the different <em>routes</em> available from the <code class="highlighter-rouge">getState</code> function.</p>
</span>
	

	<p><span class="fa-pull-left top-of-tutorial-repo-link"><span class="first-word">Full</span>, runnable src of <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/javascript/tutorials/34_get_state_replacement_api">Get State Replacement Api</a> can be downloaded as part of: <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/javascript">tutorials/javascript</a>.</span>
<br /></p>

<h2 id="intro">Intro</h2>

<p>With the <code class="highlighter-rouge">getState</code> API call retrieving ALL block information and now being deprecated, a more efficient process is required to call only the dataset that you require for a your specific application. There are a couple different <code class="highlighter-rouge">routes</code> (data groupings) that can be found within the <code class="highlighter-rouge">getState</code> function. Each of these will be described and a replacement API call will be discussed.</p>

<p>Included in this single <code class="highlighter-rouge">getState</code> call is the list of content being requested, the latest Dynamic Global Properties, the latest Account Data for the authors included in the results, and the current feed price. The <code class="highlighter-rouge">getState</code> function is great in order to get the first 20 posts (and account information based on the post authors) based on the selected tag. If the query field is left empty <code class="highlighter-rouge">getState</code> automatically calls info based on the <code class="highlighter-rouge">trending</code> tag. <code class="highlighter-rouge">getState</code> can also be used to call information for a specific account.</p>

<p>The call <code class="highlighter-rouge">routes</code> that will be covered are for:</p>

<ol>
  <li><a href="#accounts"><strong>accounts</strong></a></li>
  <li><a href="#content"><strong>content</strong></a></li>
  <li><a href="#price"><strong>feed_price</strong></a></li>
  <li><a href="#props"><strong>props</strong></a></li>
  <li><a href="#tags"><strong>tags</strong></a></li>
  <li><a href="#tagidx"><strong>tag_idx</strong></a></li>
  <li><a href="#schedule"><strong>witness_schedule</strong></a></li>
  <li><a href="#witness"><strong>witnesses</strong></a></li>
</ol>

<h4 id="current-getstate-result">Current getState() result:</h4>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"current_route"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"props"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"head_block_number"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"head_block_id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0000000000000000000000000000000000000000"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"current_witness"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"total_pow"</span><span class="p">:</span><span class="w"> </span><span class="s2">"18446744073709551615"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"num_pow_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"virtual_supply"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"current_supply"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"confidential_supply"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"current_sbd_supply"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"confidential_sbd_supply"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"total_vesting_fund_steem"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"total_vesting_shares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"total_reward_fund_steem"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"total_reward_shares2"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"pending_rewarded_vesting_shares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"pending_rewarded_vesting_steem"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"sbd_interest_rate"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"sbd_print_rate"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
    </span><span class="nl">"maximum_block_size"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"current_aslot"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"recent_slots_filled"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"participation_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"last_irreversible_block_num"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"vote_power_reserve_rate"</span><span class="p">:</span><span class="w"> </span><span class="mi">40</span><span class="p">,</span><span class="w">
    </span><span class="nl">"average_block_size"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"current_reserve_ratio"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"max_virtual_bandwidth"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0"</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"tag_idx"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"trending"</span><span class="p">:</span><span class="w"> </span><span class="p">[]},</span><span class="w">
  </span><span class="nl">"tags"</span><span class="p">:</span><span class="w"> </span><span class="p">{},</span><span class="w">
  </span><span class="nl">"content"</span><span class="p">:</span><span class="w"> </span><span class="p">{},</span><span class="w">
  </span><span class="nl">"accounts"</span><span class="p">:</span><span class="w"> </span><span class="p">{},</span><span class="w">
  </span><span class="nl">"witnesses"</span><span class="p">:</span><span class="w"> </span><span class="p">{},</span><span class="w">
  </span><span class="nl">"discussion_idx"</span><span class="p">:</span><span class="w"> </span><span class="p">{},</span><span class="w">
  </span><span class="nl">"witness_schedule"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"current_virtual_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"next_shuffle_block_num"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"current_shuffled_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
    </span><span class="nl">"num_scheduled_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"top19_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"timeshare_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w">
    </span><span class="nl">"miner_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"witness_pay_normalization_factor"</span><span class="p">:</span><span class="w"> </span><span class="mi">25</span><span class="p">,</span><span class="w">
    </span><span class="nl">"median_props"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
      </span><span class="nl">"account_creation_fee"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"maximum_block_size"</span><span class="p">:</span><span class="w"> </span><span class="mi">131072</span><span class="p">,</span><span class="w">
      </span><span class="nl">"sbd_interest_rate"</span><span class="p">:</span><span class="w"> </span><span class="mi">1000</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="nl">"majority_version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.0.0"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"max_voted_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">19</span><span class="p">,</span><span class="w">
    </span><span class="nl">"max_miner_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"max_runner_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"hardfork_required_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">17</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"feed_price"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"base"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w"> </span><span class="nl">"quote"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">},</span><span class="w">
  </span><span class="nl">"error"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h2 id="use-cases-and-data-sets">Use cases and data sets</h2>

<h4 id="route-getstateaccounts">Route: getState(‘accounts’)<a name="accounts"></a></h4>

<ul>
  <li>
    <p>Purpose: Returns a list of account objects for the top 20 trending post authors or a single account if specified.</p>
  </li>
  <li>
    <p>Replacement API call:</p>
  </li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">getAccounts</span><span class="p">([</span><span class="dl">'</span><span class="s1">username</span><span class="dl">'</span><span class="p">])</span>
</code></pre></div></div>

<p>In order to get the full compliment of account information for a specified account, <code class="highlighter-rouge">getAccounts</code> can be used as in the example above. If you require this information for the top 20 trending authors, you can use the function as per <code class="highlighter-rouge">getState('content')</code> to retrieve the author names and then get the information per individual. The account information can be used to track balances, vesting, followers, witness votes and pending rewards among others.</p>

<ul>
  <li>Expected result:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"active"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"weight_threshold"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"account_auths"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
    </span><span class="nl">"key_auths"</span><span class="p">:</span><span class="w"> </span><span class="p">[]</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"average_bandwidth"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"average_market_bandwidth"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"can_vote"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
  </span><span class="nl">"comment_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"created"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2016-03-26T08:26:21"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"curation_rewards"</span><span class="p">:</span><span class="w"> </span><span class="mi">396530808</span><span class="p">,</span><span class="w">
  </span><span class="nl">"delegated_vesting_shares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"505881.492379 VESTS"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"guest_bloggers"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">340</span><span class="p">,</span><span class="w">
  </span><span class="nl">"json_metadata"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"profile"</span><span class="p">:{</span><span class="nl">"name"</span><span class="p">:,</span><span class="nl">"profile_image"</span><span class="p">:}},</span><span class="w">
  </span><span class="nl">"last_account_recovery"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_account_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-08-30T01:48:15"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_bandwidth_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_market_bandwidth_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_owner_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2017-11-22T03:58:09"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_post"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-26T18:32:30"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_root_post"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-26T16:07:51"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_vote_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-26T16:23:09"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"lifetime_bandwidth"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"lifetime_market_bandwidth"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"lifetime_vote_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"market_history"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"memo_key"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"mined"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
  </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"next_vesting_withdrawal"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1969-12-31T23:59:59"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"other_history"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"owner"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"weight_threshold"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"account_auths"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
    </span><span class="nl">"key_auths"</span><span class="p">:</span><span class="w"> </span><span class="p">[]</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"pending_claimed_accounts"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"post_bandwidth"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
  </span><span class="nl">"post_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">6289</span><span class="p">,</span><span class="w">
  </span><span class="nl">"post_history"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"posting"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"weight_threshold"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
    </span><span class="nl">"account_auths"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
    </span><span class="nl">"key_auths"</span><span class="p">:</span><span class="w"> </span><span class="p">[]</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"posting_rewards"</span><span class="p">:</span><span class="w"> </span><span class="mi">30925563</span><span class="p">,</span><span class="w">
  </span><span class="nl">"proxied_vsf_votes"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"1466563679903716"</span><span class="p">,</span><span class="w"> </span><span class="s2">"754759334883"</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">],</span><span class="w">
  </span><span class="nl">"proxy"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"received_vesting_shares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000000 VESTS"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"recovery_account"</span><span class="p">:</span><span class="w"> </span><span class="s2">"steem"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"reputation"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"reset_account"</span><span class="p">:</span><span class="w"> </span><span class="s2">"null"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"reward_sbd_balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"reward_steem_balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"reward_vesting_balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"967.889424 VESTS"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"reward_vesting_steem"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.479 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"savings_balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"savings_sbd_balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"savings_sbd_last_interest_payment"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"savings_sbd_seconds"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"savings_sbd_seconds_last_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"savings_withdraw_requests"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_last_interest_payment"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-08T13:46:15"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_seconds"</span><span class="p">:</span><span class="w"> </span><span class="s2">"79984344"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_seconds_last_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-26T17:36:15"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"tags_usage"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"to_withdraw"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"transfer_history"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"vesting_balance"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"vesting_shares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"26772189.757016 VESTS"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"vesting_withdraw_rate"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000000 VESTS"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"vote_history"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"voting_manabar"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"current_mana"</span><span class="p">:</span><span class="w"> </span><span class="s2">"5514091390534"</span><span class="p">,</span><span class="w"> </span><span class="nl">"last_update_time"</span><span class="p">:</span><span class="w"> </span><span class="mi">1537978989</span><span class="p">},</span><span class="w">
  </span><span class="nl">"voting_power"</span><span class="p">:</span><span class="w"> </span><span class="mi">2099</span><span class="p">,</span><span class="w">
  </span><span class="nl">"withdraw_routes"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"withdrawn"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"witness_votes"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"witnesses_voted_for"</span><span class="p">:</span><span class="w"> </span><span class="mi">24</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="route-getstatecontent">Route: getState(‘content’)<a name="content"></a></h4>

<ul>
  <li>
    <p>Purpose: The <code class="highlighter-rouge">content</code> in getState calls the top 20 trending posts</p>
  </li>
  <li>
    <p>Replacement API call:</p>
  </li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="dl">'</span><span class="s1">get_discussions_by_trending</span><span class="dl">'</span><span class="p">,[{</span><span class="na">limit</span><span class="p">:</span><span class="mi">20</span><span class="p">}])</span>
</code></pre></div></div>

<p>While <code class="highlighter-rouge">getState()</code> truncates the post body at 1024 characters, <code class="highlighter-rouge">getDiscussionsBy</code> will not truncate the body unless you provide a truncate_body value in the query structure. <code class="highlighter-rouge">getDiscussionsBy</code> can be executed by trending, created, active, cashout, payout, votes, children, hot, feed, blog or comments. This provides a wide range by which the posts can be called depending on the specific needs. Within the <code class="highlighter-rouge">query</code> parameter specific tags, filters, authors and permlinks can be provided. The limit can also be increased to a maximum of 100 posts where <code class="highlighter-rouge">getState</code> is limited to the first 20. You can also refer to the <a href="https://developers.steem.io/tutorials-javascript/get_posts">get post</a> tutorial for a simplified database call for posts. The detail provided by this statement can be used to track pending payouts, curator rewards and votes for the trending, or specified posts.</p>

<ul>
  <li>Expected result:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"abs_rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"60411661082705"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"active"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-26T19:47:15"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"active_votes"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"allow_curation_rewards"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
  </span><span class="nl">"allow_replies"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
  </span><span class="nl">"allow_votes"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
  </span><span class="nl">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">"therealwolf"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"author_reputation"</span><span class="p">:</span><span class="w"> </span><span class="s2">"100096076084764"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"author_rewards"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"beneficiaries"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"body"</span><span class="p">:</span><span class="w"> </span><span class="s2">"......"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"body_length"</span><span class="p">:</span><span class="w"> </span><span class="mi">4577</span><span class="p">,</span><span class="w">
  </span><span class="nl">"cashout_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-10-02T13:52:24"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"category"</span><span class="p">:</span><span class="w"> </span><span class="s2">"witness-update"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"children"</span><span class="p">:</span><span class="w"> </span><span class="mi">7</span><span class="p">,</span><span class="w">
  </span><span class="nl">"children_abs_rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"60493226759117"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"created"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-25T13:52:24"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"curator_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"depth"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">63318715</span><span class="p">,</span><span class="w">
  </span><span class="nl">"json_metadata"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"tags"</span><span class="p">:[]},</span><span class="w">
  </span><span class="nl">"last_payout"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-26T19:17:33"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"max_accepted_payout"</span><span class="p">:</span><span class="w"> </span><span class="s2">"100000.000 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"max_cashout_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1969-12-31T23:59:59"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"net_rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"60411661082705"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"net_votes"</span><span class="p">:</span><span class="w"> </span><span class="mi">179</span><span class="p">,</span><span class="w">
  </span><span class="nl">"parent_author"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
  </span><span class="nl">"parent_permlink"</span><span class="p">:</span><span class="w"> </span><span class="s2">"witness-update"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"pending_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"80.490 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"percent_steem_dollars"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
  </span><span class="nl">"permlink"</span><span class="p">:</span><span class="w"> </span><span class="s2">"witness-essentials-hf20-ready"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"promoted"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"reblogged_by"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"replies"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
  </span><span class="nl">"reward_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
  </span><span class="nl">"root_author"</span><span class="p">:</span><span class="w"> </span><span class="s2">"therealwolf"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"root_permlink"</span><span class="p">:</span><span class="w"> </span><span class="s2">"witness-essentials-hf20-ready"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"root_title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Witness Essentials: HF20 Ready"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Witness Essentials: HF20 Ready"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_pending_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_vote_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">7795119</span><span class="p">,</span><span class="w">
  </span><span class="nl">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/witness-update/@therealwolf/witness-essentials-hf20-ready"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"vote_rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"60411661082705"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="route-getstatefeed_price">Route: getState(‘feed_price’)<a name="price"></a></h4>

<ul>
  <li>
    <p>Purpose: The price feed is used by the Steem blockchain when it calculates how many SBD it owes for its author rewards. It is also used to calculate the worth in $US displayed in the wallet. The price feed is the median price feed of the last 3.5 days of all the top 20 witnesses’ price feed.</p>
  </li>
  <li>
    <p>Replacement API call:</p>
  </li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">getCurrentMedianHistoryPrice</span><span class="p">()</span>
</code></pre></div></div>

<p>This provides the same data as <code class="highlighter-rouge">getState</code> but is executed much faster due to the limited amount of information provided by this function.</p>

<ul>
  <li>Expected result:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"base"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"amount"</span><span class="p">:</span><span class="err"> </span><span class="mf">0.887</span><span class="p">,</span><span class="err"> </span><span class="nl">"symbol"</span><span class="p">:</span><span class="err"> </span><span class="s2">"SBD"</span><span class="p">},</span><span class="w">
  </span><span class="nl">"quote"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"amount"</span><span class="p">:</span><span class="err"> </span><span class="mi">1</span><span class="p">,</span><span class="err"> </span><span class="nl">"symbol"</span><span class="p">:</span><span class="err"> </span><span class="s2">"STEEM"</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="route-getstateprops">Route: getState(‘props’)<a name="props"></a></h4>

<ul>
  <li>
    <p>Purpose: Provides detailed information of the block properties. Block number, witness, current STEEM and SBD supply, pending rewards and total vesting fund and shares among others.</p>
  </li>
  <li>
    <p>Replacement API call:</p>
  </li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">//all block info</span>
<span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">getDynamicGlobalProperties</span><span class="p">()</span>
<span class="c1">//head block number only</span>
<span class="nx">blockchainAPI</span><span class="p">.</span><span class="nx">getCurrentBlockNum</span><span class="p">()</span>
<span class="c1">//simple head block info</span>
<span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">getBlock</span><span class="p">(</span><span class="nx">HeadBlockNum</span><span class="p">)</span>
</code></pre></div></div>

<p><code class="highlighter-rouge">getDynamicGlobalProperties()</code> provides the same level of information and tracks the same values for each created block. You can also call a simplified version of block info containing only the block_id, previous block_id, signing_key, timestamp, witness and witness signature by using the current head block number with the <code class="highlighter-rouge">getBlock</code> database call.</p>

<ul>
  <li>Expected result:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"average_block_size"</span><span class="p">:</span><span class="mi">122</span><span class="p">,</span><span class="w">
  </span><span class="nl">"confidential_sbd_supply"</span><span class="p">:</span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"confidential_supply"</span><span class="p">:</span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"current_aslot"</span><span class="p">:</span><span class="mi">26372251</span><span class="p">,</span><span class="w">
  </span><span class="nl">"current_reserve_ratio"</span><span class="p">:</span><span class="mi">200000000</span><span class="p">,</span><span class="w">
  </span><span class="nl">"current_sbd_supply"</span><span class="p">:</span><span class="s2">"14921682.900 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"current_supply"</span><span class="p">:</span><span class="s2">"277501868.004 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"current_witness"</span><span class="p">:</span><span class="s2">"ausbitbank"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"delegation_return_period"</span><span class="p">:</span><span class="mi">432000</span><span class="p">,</span><span class="w">
  </span><span class="nl">"head_block_id"</span><span class="p">:</span><span class="s2">"0190f89c584661d6ffc78e17395df17ea5653197"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"head_block_number"</span><span class="p">:</span><span class="mi">26278044</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_irreversible_block_num"</span><span class="p">:</span><span class="mi">26278024</span><span class="p">,</span><span class="w">
  </span><span class="nl">"max_virtual_bandwidth"</span><span class="p">:</span><span class="s2">"264241152000000000000"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"maximum_block_size"</span><span class="p">:</span><span class="mi">65536</span><span class="p">,</span><span class="w">
  </span><span class="nl">"num_pow_witnesses"</span><span class="p">:</span><span class="mi">172</span><span class="p">,</span><span class="w">
  </span><span class="nl">"participation_count"</span><span class="p">:</span><span class="mi">126</span><span class="p">,</span><span class="w">
  </span><span class="nl">"pending_rewarded_vesting_shares"</span><span class="p">:</span><span class="s2">"483834672.069834 VESTS"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"pending_rewarded_vesting_steem"</span><span class="p">:</span><span class="s2">"237227.812 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"recent_slots_filled"</span><span class="p">:</span><span class="s2">"340282366911034938426725082362930003967"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"reverse_auction_seconds"</span><span class="p">:</span><span class="mi">900</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_interest_rate"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_print_rate"</span><span class="p">:</span><span class="mi">10000</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_start_percent"</span><span class="p">:</span><span class="mi">900</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_stop_percent"</span><span class="p">:</span><span class="mi">1000</span><span class="p">,</span><span class="w">
  </span><span class="nl">"time"</span><span class="p">:</span><span class="s2">"2018-09-26T08:52:33"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_pow"</span><span class="p">:</span><span class="mi">514415</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_reward_fund_steem"</span><span class="p">:</span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_reward_shares2"</span><span class="p">:</span><span class="s2">"0"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_vesting_fund_steem"</span><span class="p">:</span><span class="s2">"196777383.890 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_vesting_shares"</span><span class="p">:</span><span class="s2">"397621943253.336916 VESTS"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"virtual_supply"</span><span class="p">:</span><span class="s2">"294324509.379 STEEM"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"vote_power_reserve_rate"</span><span class="p">:</span><span class="mi">10</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="route-getstatetags">Route: getState(‘tags’)<a name="tags"></a></h4>

<ul>
  <li>
    <p>Purpose: Calls a list of trending tags with detailed information on each tag. The list is displayed alphabetically.</p>
  </li>
  <li>
    <p>Replacement API call:</p>
  </li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="dl">'</span><span class="s1">get_trending_tags</span><span class="dl">'</span><span class="p">,[</span><span class="nx">startingValue</span><span class="p">,</span> <span class="nx">limit</span><span class="p">])</span>
</code></pre></div></div>

<p>The <code class="highlighter-rouge">getTrendingTags</code> function calls the same information as with <code class="highlighter-rouge">getState</code> but can be limited in the number of results. The data on each tag includes the number of votes and comments made with that tag as well as the total payouts for that tag. This is useful to determine which tags are most popular to assist in effective post creation.</p>

<ul>
  <li>Expected result:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"comments"</span><span class="p">:</span><span class="w"> </span><span class="mi">31203776</span><span class="p">,</span><span class="w">
  </span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"life"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"net_votes"</span><span class="p">:</span><span class="w"> </span><span class="mi">54671586</span><span class="p">,</span><span class="w">
  </span><span class="nl">"top_posts"</span><span class="p">:</span><span class="w"> </span><span class="mi">4996200</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_payouts"</span><span class="p">:</span><span class="w"> </span><span class="s2">"61584243.124 SBD"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"trending"</span><span class="p">:</span><span class="w"> </span><span class="s2">"114450355665"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="route-getstatetag_idx">Route: getState(‘tag_idx’)<a name="tagidx"></a></h4>

<ul>
  <li>
    <p>Purpose: Provides a list of names (index) of the current tags (according to trending) available on the blockchain with no additional information.</p>
  </li>
  <li>
    <p>Replacement API call:</p>
  </li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="dl">'</span><span class="s1">get_trending_tags</span><span class="dl">'</span><span class="p">,[</span><span class="nx">startingValue</span><span class="p">,</span> <span class="nx">limit</span><span class="p">])</span>
</code></pre></div></div>

<p>This information can be gained by the using the same method as for <code class="highlighter-rouge">getState('tags')</code> and then only displaying the <code class="highlighter-rouge">name</code> object of the array of tags provided. You can refer to the tutorial <a href="https://developers.steem.io/tutorials-javascript/search_tags">search tags</a> for a detailed example of this.</p>

<ul>
  <li>Expected result:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="s2">"life"</span><span class="w">
  </span><span class="s2">"photography"</span><span class="w">
  </span><span class="s2">"kr"</span><span class="w">
  </span><span class="s2">"steemit"</span><span class="w">
  </span><span class="s2">"bitcoin"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="route-getstatewitness_schedule">Route: getState(‘witness_schedule’)<a name="schedule"></a></h4>

<ul>
  <li>
    <p>Purpose: Calls the current round’s schedule. Every round consists of 21 3-second blocks. This includes the top 19 witnesses, a miner witness, and a backup witness. The <code class="highlighter-rouge">current_virtual_time</code> is used to aid in choosing the next witness. <code class="highlighter-rouge">next_shuffle_block_num</code> indicates when the current list will be shuffled.</p>
  </li>
  <li>
    <p>Replacement API call:</p>
  </li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">//full info</span>
<span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="dl">'</span><span class="s1">get_witness_schedule</span><span class="dl">'</span><span class="p">,[])</span>
<span class="c1">//median props only</span>
<span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">getChainProperties</span><span class="p">()</span>
</code></pre></div></div>

<p>If required you can also call the <code class="highlighter-rouge">median_props</code> values as standalone via the second function listed above.</p>

<ul>
  <li>Expected result:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"account_subsidy_rd"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"resource_unit"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
    </span><span class="nl">"budget_per_time_unit"</span><span class="p">:</span><span class="w"> </span><span class="mi">797</span><span class="p">,</span><span class="w">
    </span><span class="nl">"pool_eq"</span><span class="p">:</span><span class="w"> </span><span class="mi">157691079</span><span class="p">,</span><span class="w">
    </span><span class="nl">"max_pool_size"</span><span class="p">:</span><span class="w"> </span><span class="mi">157691079</span><span class="p">,</span><span class="w">
    </span><span class="nl">"decay_params"</span><span class="p">:</span><span class="w"> </span><span class="p">{},</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"account_subsidy_witness_rd"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"resource_unit"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
    </span><span class="nl">"budget_per_time_unit"</span><span class="p">:</span><span class="w"> </span><span class="mi">996</span><span class="p">,</span><span class="w">
    </span><span class="nl">"pool_eq"</span><span class="p">:</span><span class="w"> </span><span class="mi">9384019</span><span class="p">,</span><span class="w">
    </span><span class="nl">"max_pool_size"</span><span class="p">:</span><span class="w"> </span><span class="mi">9384019</span><span class="p">,</span><span class="w">
    </span><span class="nl">"decay_params"</span><span class="p">:</span><span class="w"> </span><span class="p">{},</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"current_shuffled_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"followbtcnews"</span><span class="p">,</span><span class="w"> </span><span class="s2">"good-karma"</span><span class="p">,</span><span class="w"> </span><span class="s2">"smooth.witness"</span><span class="p">,</span><span class="w"> </span><span class="s2">"anyx"</span><span class="p">,</span><span class="w"> </span><span class="s2">"thecryptodrive"</span><span class="p">,</span><span class="w"> </span><span class="s2">"jesta"</span><span class="p">,</span><span class="w"> </span><span class="s2">"utopian-io"</span><span class="p">,</span><span class="w"> </span><span class="s2">"cervantes"</span><span class="p">,</span><span class="w"> </span><span class="s2">"roelandp"</span><span class="p">,</span><span class="w"> </span><span class="s2">"aggroed"</span><span class="p">,</span><span class="w"> </span><span class="s2">"blocktrades"</span><span class="p">,</span><span class="w"> </span><span class="s2">"gtg"</span><span class="p">,</span><span class="w"> </span><span class="s2">"xeldal"</span><span class="p">,</span><span class="w"> </span><span class="s2">"lukestokes.mhth"</span><span class="p">,</span><span class="w"> </span><span class="s2">"someguy123"</span><span class="p">,</span><span class="w"> </span><span class="s2">"pfunk"</span><span class="p">,</span><span class="w"> </span><span class="s2">"ausbitbank"</span><span class="p">,</span><span class="w"> </span><span class="s2">"furion"</span><span class="p">,</span><span class="w"> </span><span class="s2">"curie"</span><span class="p">,</span><span class="w"> </span><span class="s2">"timcliff"</span><span class="p">,</span><span class="w"> </span><span class="s2">"clayop"</span><span class="p">],</span><span class="w">
  </span><span class="nl">"current_virtual_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"376982753287696133965407589"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"elected_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
  </span><span class="nl">"hardfork_required_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">17</span><span class="p">,</span><span class="w">
  </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"majority_version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.20.3"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"max_miner_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"max_runner_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
  </span><span class="nl">"max_voted_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">20</span><span class="p">,</span><span class="w">
  </span><span class="nl">"median_props"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"account_creation_fee"</span><span class="p">:</span><span class="w"> </span><span class="s2">"3.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"maximum_block_size"</span><span class="p">:</span><span class="w"> </span><span class="mi">65536</span><span class="p">,</span><span class="w">
    </span><span class="nl">"sbd_interest_rate"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"account_subsidy_budget"</span><span class="p">:</span><span class="w"> </span><span class="mi">797</span><span class="p">,</span><span class="w">
    </span><span class="nl">"account_subsidy_decay"</span><span class="p">:</span><span class="w"> </span><span class="mi">347321</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"min_witness_account_subsidy_decay"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"miner_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
  </span><span class="nl">"next_shuffle_block_num"</span><span class="p">:</span><span class="w"> </span><span class="mi">26313756</span><span class="p">,</span><span class="w">
  </span><span class="nl">"num_scheduled_witnesses"</span><span class="p">:</span><span class="w"> </span><span class="mi">21</span><span class="p">,</span><span class="w">
  </span><span class="nl">"timeshare_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w">
  </span><span class="nl">"witness_pay_normalization_factor"</span><span class="p">:</span><span class="w"> </span><span class="mi">25</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h4 id="route-getstatewitnesses">Route: getState(‘witnesses’)<a name="witness"></a></h4>

<ul>
  <li>
    <p>Purpose: Calls a list of active witnesses with extended details, listed alphabetically</p>
  </li>
  <li>
    <p>Replacement API call:</p>
  </li>
</ul>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">databaseAPI</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="dl">'</span><span class="s1">get_witnesses_by_vote</span><span class="dl">'</span><span class="p">,[</span><span class="dl">''</span><span class="p">,</span><span class="nx">limit</span><span class="p">])</span>
</code></pre></div></div>

<p>This detailed information can be used to track the performance of a specific witness when deciding for who to vote or for your own witness statistics. The detail includes the amount of votes, blocks missed and also the SBD exchange rate (feed price) that this witness is reporting. This function calls the info listed according to total votes.</p>

<ul>
  <li>Expected result:</li>
</ul>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"available_witness_account_subsidies"</span><span class="p">:</span><span class="w"> </span><span class="mi">9138354</span><span class="p">,</span><span class="w">
  </span><span class="nl">"created"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"hardfork_time_vote"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-25T15:00:00"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"hardfork_version_vote"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.20.0"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">9493</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_aslot"</span><span class="p">:</span><span class="w"> </span><span class="mi">26387405</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_confirmed_block_num"</span><span class="p">:</span><span class="w"> </span><span class="mi">26293189</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_sbd_exchange_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-09-26T19:54:36"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"last_work"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0000000048bf77f525731f28db7c1aa9ad853a475ccc78e71ea952a7782e5459"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"owner"</span><span class="p">:</span><span class="w"> </span><span class="s2">"gtg"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"pow_worker"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
  </span><span class="nl">"props"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
    </span><span class="nl">"account_creation_fee"</span><span class="p">:</span><span class="w"> </span><span class="s2">"3.000 STEEM"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"maximum_block_size"</span><span class="p">:</span><span class="w"> </span><span class="mi">65536</span><span class="p">,</span><span class="w">
    </span><span class="nl">"sbd_interest_rate"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"account_subsidy_budget"</span><span class="p">:</span><span class="w"> </span><span class="mi">797</span><span class="p">,</span><span class="w">
    </span><span class="nl">"account_subsidy_decay"</span><span class="p">:</span><span class="w"> </span><span class="mi">347321</span><span class="w">
  </span><span class="p">},</span><span class="w">
  </span><span class="nl">"running_version"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.20.3"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"sbd_exchange_rate"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="nl">"base"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.893 SBD"</span><span class="p">,</span><span class="w"> </span><span class="nl">"quote"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1.000 STEEM"</span><span class="p">},</span><span class="w">
  </span><span class="nl">"signing_key"</span><span class="p">:</span><span class="w"> </span><span class="s2">"STM5T98tp8jZRbs7zzyCg74o2siqBw2SXxoYaE1MCuwuCPeQwKrju"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"total_missed"</span><span class="p">:</span><span class="w"> </span><span class="mi">535</span><span class="p">,</span><span class="w">
  </span><span class="nl">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"https://steemit.com/witness-category/@gtg/witness-gtg"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"virtual_last_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"376717145948220892034052885"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"virtual_position"</span><span class="p">:</span><span class="w"> </span><span class="s2">"240558419146717570415939163840356145056"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"virtual_scheduled_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"376718433464807443533288610"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"votes"</span><span class="p">:</span><span class="w"> </span><span class="s2">"77454495589313361"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<h3 id="to-run-this-tutorial">To run this tutorial</h3>

<ol>
  <li><code class="highlighter-rouge">git clone https://gitlab.syncad.com/hive/devportal.git</code></li>
  <li><code class="highlighter-rouge">cd devportal/tutorials/javascript/34_get_state_replacement_api</code></li>
  <li><code class="highlighter-rouge">npm i</code></li>
  <li><code class="highlighter-rouge">npm run dev-server</code> or <code class="highlighter-rouge">npm run start</code></li>
  <li>After a few moments, the server should be running at http://localhost:3000/</li>
</ol>

<hr />

</section>

</div>
<div class="footer">
  <a href="#">Back to top</a>
</div>
<script>
    document.getElementById("open-nav").addEventListener("click", function () {
        document.body.classList.toggle("nav-open");
    });
</script>
</body>
</html>


<script src="/js/adjust.js"></script>

